package com.hr.controller;

import com.hr.entity.ConfigFileThirdKind;
import com.hr.entity.R;
import com.hr.service.ConfigFileThirdKindService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.hr.service.ConfigFileThirdKindService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


import java.util.List;

@RestController
@RequestMapping("/configFileThirdKind")
public class ConfigFileThirdKindController {

    @Autowired
    private ConfigFileThirdKindService service;

    /**
     * 查询三级机构设置列表
     * @return
     */
    @GetMapping("/queryList")
    public List<ConfigFileThirdKind> queryList(ConfigFileThirdKind configFileThirdKind){
        List<ConfigFileThirdKind> list = service.queryList(configFileThirdKind);
        return list;
    }

    /**
     * 保存/修改
     * @param configFileThirdKind
     * @return
     */
    @PostMapping("/save")
    public R save(
            @RequestBody
            ConfigFileThirdKind configFileThirdKind){
        boolean save = service.save(configFileThirdKind);
        return save ? R.ok("保存成功"):R.fail("保存失败");
    }

    /**
     * 删除
     * @param ftkid
     * @return
     */
    @DeleteMapping("/del")
    public R del(Integer ftkid){
        boolean del = service.del(ftkid);
        return del ? R.ok("删除成功"):R.fail("删除失败");
    }

    /**
     *
     * @param ftkid
     * @return
     */
    @GetMapping("/queryById")
    public ConfigFileThirdKind queryById(Integer ftkid){
        ConfigFileThirdKind configFileThirdKind = service.queryById(ftkid);
        return configFileThirdKind;
    }

}
